package com.ctosb.classviewer.clazz.attr;

import com.ctosb.classviewer.ClassReader;
import com.ctosb.classviewer.clazz.AbstractParse;
import com.ctosb.classviewer.clazz.Parseable;
import lombok.Data;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
public class Array_element_value extends AbstractParse {

    private short num_values;
    private Element_value values[];

    @Override
    public Array_element_value parse(ClassReader classReader) {
        num_values = classReader.readShort();
        values = new Element_value[num_values & 0xffff];
        for (int i = 0; i < values.length; i++) {
            values[i] = new Element_value().parse(classReader, getClassFile());
        }
        return this;
    }
}